package com.example.addressbook.service;


import com.example.addressbook.dao.LinkmanRepository;
import com.example.addressbook.entities.Linkman;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LinkmanService {

    @Autowired
    LinkmanRepository linkmanRepository;

    public Linkman save(Linkman linkman){

        return linkmanRepository.save(linkman);
    }

    public List<Linkman> getAll(){
        return linkmanRepository.findAll();
    }

    public Linkman findById(long thID) {
        return linkmanRepository.findById(thID);
    }


    public void delete(Linkman linkman) {
        linkmanRepository.delete(linkman);
    }
}
